package com.dxy.chatserver.mapper;

import com.dxy.chatserver.db.entity.EsOnlineMessageBuild;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface EsMapper extends ElasticsearchRepository<EsOnlineMessageBuild,String> {

    List<EsOnlineMessageBuild> findAllByContent(String context);

    Page<EsOnlineMessageBuild> findByCreateTimeBeforeAndSessionIdOrderByCreateTimeDesc(Long start,String sessionId, Pageable pageable);

    Page<EsOnlineMessageBuild> findBySessionBuildAndCreateTimeLessThanEqualAndCreateTimeGreaterThanOrderByCreateTimeDesc(String sessionId,Long end,Long start, Pageable pageable);

    Page<EsOnlineMessageBuild> findBySessionBuildAndCreateTimeLessThanEqualAndCreateTimeGreaterThanOrderByCreateTimeAsc(String sessionId,Long end,Long start, Pageable pageable);

}
